7 typedef pair
<int, int> par
;
14 void match(const string
&s
){
15 //cout << "Matching: " << s << endl;
16 for (int i
=0, n
= s
.size(); i
<n
; ++i
){
17 assert(line
[pos
++] == s
[i
]);
22 if (line
[pos
] == '('){
26 //cout << "a es: (" << a.first << ", " << a.second << ")" << endl;
27 //cout << "b es: (" << b.first << ", " << b.second << ")" << endl;
28 if (a
.second
!= b
.first
){
32 total
+= a
.first
* a
.second
* b
.second
;
33 return par(a
.first
, b
.second
);
34 }else if ('A' <= line
[pos
] && line
[pos
] <= 'Z'){
52 while (getline(cin
, line
) && line
!= ""){
53 //cout << "line es: " << line << endl;
58 cout
<< "error" << endl
;
60 cout
<< total
<< endl
;